package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 修改密码界面
 */
public class ChangePwdPanel extends JPanel implements ActionListener {
    private ATM05 atm05;
    private JLabel oldPwdLabel = new JLabel("请输入旧密码密码:");
    private JPasswordField oldPwdField = new JPasswordField();
    private JLabel pwdLabel = new JLabel("请输入新密码密码:");
    private JPasswordField pwdField = new JPasswordField();
    private JLabel pwdLabel01 = new JLabel("请再次输入新密码密码:");
    private JPasswordField pwdField01 = new JPasswordField();
    private JButton sureBtn = new JButton(new ImageIcon("images/buttonSure.jpg"));
    private JButton clearBtn = new JButton(new ImageIcon("images/buttonClear.jpg"));
    private Font font = new Font("宋体",Font.BOLD,25);

    public ChangePwdPanel(ATM05 atm05){
        this.atm05 = atm05;
        this.setLayout(null);
        this.setOpaque(false);

        oldPwdLabel.setBounds(200,200,250,50);
        oldPwdLabel.setFont(font);
        oldPwdField.setBounds(450,200,250,50);
        oldPwdField.setFont(font);
        pwdLabel.setBounds(200,250,250,50);
        pwdLabel.setFont(font);
        pwdField.setBounds(450,250,250,50);
        pwdField.setFont(font);
        pwdLabel01.setBounds(150,300,300,50);
        pwdLabel01.setFont(font);
        pwdField01.setBounds(450,300,250,50);
        pwdField01.setFont(font);
        sureBtn.setBounds(320,380,100,50);
        clearBtn.setBounds(450,380,100,50);
        sureBtn.addActionListener(this);

        this.add(oldPwdLabel);
        this.add(oldPwdField);
        this.add(pwdLabel);
        this.add(pwdField);
        this.add(pwdLabel01);
        this.add(pwdField01);
        this.add(sureBtn);
        this.add(clearBtn);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        atm05.showPanel("menu");
    }
}
